package com.example.diagnodroid;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class TestEntry extends RelativeLayout {
	private ImageView imageView;
	private TextView textName;
	private TextView textDesc;

	public TestEntry(Context context, AttributeSet attrs) {
		super(context, attrs);
		imageView = (ImageView) findViewById(R.id.test_image);
		textName = (TextView) findViewById(R.id.test_name);
		textDesc = (TextView) findViewById(R.id.test_desc);
	}
	
	public View inflate(Context context){
		return RelativeLayout.inflate(context, R.layout.test_entry, null);
	}
	
	public void updateEntry(Test test){
		imageView.setImageResource(test.getImage());
		textName.setText(test.getName());
		textDesc.setText(test.getDescription());
	}
	
	public String getTestName(){
		return textName.getText().toString();
	}
}
